package parser

import (
	"org/leazen/golearning/crawler/engine"
	"regexp"
	"log"
)

const cityRe = `<a href="(http://[a-z0-9A-Z]+.zhenai.com/u/[0-9]+)"[^>]*>([^<]+)</a>`

func ParseCity(contents []byte) engine.ParseResult  {



	re := regexp.MustCompile(cityRe)
	macthes := re.FindAllSubmatch(contents, -1)
	log.Printf("ParseCity %d",len(macthes))
	result := engine.ParseResult{}
	for _, m := range macthes {
		result.Items = append(result.Items, "User "+string(m[2]))
		result.Requests = append(result.Requests, engine.Request{
			Url:       string(m[1]),
			ParseFunc: ParseProfile,
		})
	}

	return result

}
